﻿using daonaite.core.Attribute;
using daonaite.Model.system.user;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace daonaite.DAL.system
{
    /// <summary>
    /// 用户操作类
    /// </summary>
    [AutoLoad]
    public class D_user
    {
        private readonly ISqlSugarClient client;

        public D_user(ISqlSugarClient client)
        {
            this.client = client;
        }

        /// <summary>
        /// 根据用户名获取用户信息
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public async Task<sys_user> getUserByUsernameAsync(string username)
        {
            return await client.Queryable<sys_user>().FirstAsync(x => x.username == username);
        }
    }
}
